<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            display: flex;
            justify-content: center;
            align-items: center;
            min-height: 100vh;
            background-color: #27282c;
            flex-direction: row;
            flex-wrap: wrap;
            gap: 60px;
        }

        a {
            position: relative;
            background-color: #444;
            width: 200px;
            font-size: 1.5em;
            display: flex;
            justify-content: center;
            color: #ccc;
            text-decoration: none;
            letter-spacing: 0.1em;
            padding: 10px 30px;
            transition: 0.5s;
        }

        a:hover {
            letter-spacing: 0.15em;
            background: var(--clr);
            color: var(--clr);
            /* 上 左 模糊 拉长 */
            box-shadow: 0 0 35px 0 var(--clr);
        }

        a::before {
            content: '';
            position: absolute;
            /* 向里缩2px */
            inset: 2px;
            background-color: #27282c;
        }

        a span {
            position: relative;
            z-index: 1;
        }

        a i {
            position: absolute;
            inset: 0;
            display: block;
        }

        a i::before {
            content: '';
            position: absolute;
            border: 2px solid #444;
            border-radius: 5px;
            background-color: #27282c;
            top: -2.5px;
            left: 80%;
            width: 10px;
            height: 5px;
            transition: 0.5s;
            transform: translateX(-50%);
        }

        a s {
            position: absolute;
            inset: 0;
            display: block;
        }

        a s::before {
            content: '';
            position: absolute;
            border: 2px solid #444;
            border-radius: 5px;
            background-color: #27282c;
            top: -2.5px;
            left: 0%;
            width: 10px;
            height: 5px;
            transition: 0.5s;
            transform: translateX(-50%);
        }

        a s::after {
            content: '';
            position: absolute;
            border: 2px solid #444;
            border-radius: 5px;
            background-color: #27282c;
            bottom: -2.5px;
            left: 100%;
            width: 10px;
            height: 5px;
            transition: 0.5s;
            transform: translateX(-50%);
        }

        a b {
            position: absolute;
            inset: 0;
            display: block;
        }

        a b::before {
            content: '';
            position: absolute;
            border: 2px solid #444;
            border-radius: 2px;
            background-color: #27282c;
            top: -2.5px;
            left: 100%;
            width: 10px;
            height: 5px;
            transition: 0.5s;
            transform: translateX(-50%);
        }

        a b::after {
            content: '';
            position: absolute;
            border: 2px solid #444;
            border-radius: 2px;
            background-color: #27282c;
            bottom: -2.5px;
            left: 0%;
            width: 10px;
            height: 5px;
            transition: 0.5s;
            transform: translateX(-50%);
        }

        a u {
            position: absolute;
            inset: 0;
            display: block;
        }

        a u::before {
            content: '';
            position: absolute;
            border: 2px solid #ccc;
            border-radius: 5px;
            background-color: #27282c;
            top: 22.5px;
            left: 0%;
            width: 10px;
            height: 5px;
            transition: 0.5s;
            transform: translateX(-50%);
        }

        a u::after {
            content: '';
            position: absolute;
            border: 2px solid #ccc;
            border-radius: 5px;
            background-color: #27282c;
            bottom: 22.5px;
            left: 100%;
            width: 10px;
            height: 5px;
            transition: 0.5s;
            transform: translateX(-50%);
            /* 不能y轴移动,为什么? */
        }


        a:hover i::before {
            border-color: var(--clr);
            width: 20px;
            left: 20%;
        }

        a i::after {
            content: '';
            position: absolute;
            border: 2px solid #444;
            border-radius: 5px;
            background-color: #27282c;
            bottom: -2.5px;
            left: 20%;
            width: 10px;
            height: 5px;
            transition: 0.5s;
            transform: translateX(-50%);
        }

        a:hover i::after {
            border-color: var(--clr);
            width: 20px;
            left: 80%;
        }
    </style>
</head>
<body>
    <a href="#"><span>Button</span><i></i><s></s><b></b><u></u></a>
    <script>
        function getRGB() {
            var str = `rgb(${Math.floor(Math.random() * 256)},${Math.floor(Math.random() * 256)},${Math.floor(Math.random() * 256)})`
            return str
        }
        var all = document.querySelectorAll('a')
        all.forEach(item => {
            var rgb = getRGB()
            item.style = '--clr:' + rgb;
            item.children[0].innerHTML = rgb.slice(4, -1)
        })
    </script>
</body>
</html>